package com.lumyc.composite;

public class CompositePatternDemo {
    public static void main(String[] args) {
        Employee CEO = new Employee("张三","CEO", 30000);

        Employee headSales = new Employee("李四","Head Sales", 20000);

        Employee headMarketing = new Employee("王五","Head Marketing", 20000);

        Employee clerk1 = new Employee("Lucy","Marketing", 10000);
        Employee clerk2 = new Employee("Maria","Marketing", 10000);

        Employee salesExecutive1 = new Employee("Tom","Sales", 10000);
        Employee salesExecutive2 = new Employee("Job","Sales", 10000);

        CEO.add(headSales);
        CEO.add(headMarketing);

        headSales.add(salesExecutive1);
        headSales.add(salesExecutive2);

        headMarketing.add(clerk1);
        headMarketing.add(clerk2);

        System.out.println(CEO);
        System.out.println("===============================");

        for (Employee headEmployee:CEO.getSubordinates()){
            System.out.println(headEmployee);
            for (Employee employee:headEmployee.getSubordinates()){
                System.out.println(employee);
            }
            System.out.println("===============================");
        }
    }
}
